package net.lab1024.sa.admin.module.app.api.user;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.constant.AdminSwaggerTagConst;
import net.lab1024.sa.base.common.annoation.AppRestController;
import net.lab1024.sa.base.common.domain.RequestUser;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.util.SmartRequestUtil;
import net.lab1024.sa.base.module.support.operatelog.annotation.OperateLog;
import org.springframework.web.bind.annotation.GetMapping;

@OperateLog
@AppRestController
@Tag(name = AdminSwaggerTagConst.App.APP_API_USER)
public class AppUserController {

    @Operation(summary = "获取当前登录用户的用户名")
    @GetMapping("/user/getUserName")
    public ResponseDTO<String> getUserName() {
        RequestUser requestUser = SmartRequestUtil.getRequestUser();
        return ResponseDTO.ok(requestUser.getUserName());
    }
}
